<?php
/**
 * (ajax)
 */
namespace App\Admin\Ajax\Quality;

use App\Models\Amazon\FbaCustomerReturn;
class FBACustomerReturnAjax {

    public function editTag($id){
        $qc = FbaCustomerReturn::query()->find($id);
        return view('quality.fba-customer-return.edit-tag-modal',compact('id','qc'));
    }

    public function doEditTag($param){
        try{
            $qc = FbaCustomerReturn::query()->find($param['id']);
            if(!$qc)return response()->json(['status' =>false, 'message' => '记录不存在']);
            $qc->tag = $param['tag'] ?? null;
            $flag = $qc->save();
            if($flag){
                return response()->json(['status' => true, 'message' => '提交成功']);
            }else{
                return response()->json(['status' =>false, 'message' => '提交失败']);
            }
        }catch (\Exception $e){
            report($e);
            return response()->json(['status' => false, 'message' => '系统异常，稍后再试']);
        }
    }
}
